Microsoft SQL Server (MS-SQL) is database management system. It can be installed on Windows and Linux operating systems and can be accessed through a variety of client tools and programming interfaces. MS-SQL used to store and retrieve data from a database. In industrial PLC and SCADA application we used MS-SQL for storing data of our process like alarm, event, history, tag value, process variable etc. MS-SQL provides data integration, data analysis, data reporting, security, scalability, and high availability, making it suitable for critical applications and process. You can also connect your MS-SQL data base with other software. MS-SQL supports a wide range of programming languages, including SQL, T-SQL, .NET, C#, and Visual Basic.MS SQL is available in Express, Standard, Enterprise, and Developer editions. We use express editions in this article link for download is given below of this article. for more information about factorytalk view datalogging visit link
ODBC is Open Database Connectivity, it is used for accessing and write data in different type of DBMS like MySQL, Oracle, and Microsoft SQL Server etc. It was developed by Microsoft to provide a common way for Windows-based applications to access data from a variety of database management systems. With the help of ODBC we can execute functions like connecting to a database, executing SQL statements, fetching results, and managing transactions. ODBC is widely used in the industry two version available 64 bit and 32 bit.
before proceed download and install MS-SQL Server Express edition. It is a free edition of SQL Server, ideal for development and production for desktop, web, and small server applications. if you have any difficulty for installation write a comment below. After installation of MS-SQL Server Express edition follow these steps for creating a database
open your FactoryTalk view studio and then In FactoryTalk View Studio, in the Explorer window, open the Data Log folder. Right-click the Data Log Models icon, and then select New. now datalog model editor will open your screen we already discuss file set storage format in this article we discuss only sql and ODBC server connectivity with FactoryTalk view studio.for Connecting SQL server to FactoryTalk View Application Data logging select storage format as ODBC data source.
when you select storage format as ODBC data source you see three tables name Tag table, string table and float table. The ODBC format stores data in up to three tables:
You can store logged data in an existing ODBC data source, or you can create a new ODBC data source. for creating a new ODBC data source follow these steps
you can set backup path for your ODBC data source. Select enable ODBC backup path than set absolute or relative path. backup files prevents to loss of any type of data if database server is not reachable or not accessible so the backup file take a backup if required you can restore these data by using backup file.
in file management tab help to delete old records from the database using standard relational database tools or SQL queries. You can also set up FactoryTalk View to delete records in the ODBC database after a specified time. select time when you want to delete old record in file management tab.
use log trigger tab to define when data logged into database. you can store data periodically, when specific value occur or on demand. in periodic trigger data store in data base at specific time interval. in on change value store at specific value. On demand data store when particular even come.
Use Tag in Modal Tab to Add Tag in Datalog Model. The Tags In Model Tab To Specify Which Tags Will Be Scanned For Data. A Data Log Model Can Contain Up To 10,000 Tags. Browse Tag And Add To Datalog Model. All Type Of Tag You Can Use For Data Logging.
after all setting in data log model press ok and set the component name of datalog model. this component you can use for event, manually or automatic data logging etc.
to start data logging in factory talkview datalog model you can use command line DataLogOn than data model name as DataLogOn 'plcblog' or right click on datalog model component and click to start.
to stop data logging in factory talkview datalog model you can use command line DataLogOFF than data model name as DataLogOFF 'plcblog' or right click on datalog model component and click to STOP.
open miscrosoft sql server management studio and select your database and open your table you see your all three table are created Format for ODBC tag table. Open Float table and following is format of ODBC float and string tables
Format for ODBC tag table The following table shows the format for ODBC tag table.